JRootPane (JFrame, JDialog and floating palette windows)

Client properties:

Property

Type Notes
Quaqua.RootPane
.isPalette
Boolean

Specifies whether the parent JFrame/JDialog of the JRootPane is used as a palette window.
Works only when the JRootPane decorates a JFrame/JDialog.

Quaqua.RootPane
.isVertical
Boolean

Specifies whether the title bar shall be placed vertically or horizontally.
Works only when the JRootPane decorates a JFrame/JDialog.

windowModified
Boolean

Sets the window modified indicator in the title bar.

UIManager properties:

Note: Users can hold down the Alt-Key while moving a window to prevent snapping.

Property

Type Notes
RootPane
.windowSnapDistance
Integer

Specifies the distance up to which windows snap to the edges of each other and to the edges of the screen. Setting this to a value to 0 or smaller, disables window snapping.

Note: Snapping is only in effect for look and feel decorated windows.

RootPane
.draggableWindowBackground
Boolean

Default value for the client property "apple.awt.draggableWindowBackground". Setting this to true makes all windows, which have a translucent area, draggable by all of their display area. This is only in rare cases desirable, for example, when only display components are on a window.

Size styles:

Client property: windowModified

 

Sets whether the document contained in the window has been modified and not saved yet.

You should set this property with an argument of Boolean.TRUE every time the window’s document changes in such a way that it needs to be saved and with an argument of Boolean.FALSE every time it gets saved. Then, before closing the window you can use getClientProperty("windowModified") to determine whether to allow the user a chance to save the document.

 

 

Client properties: Quaqua.RootPane.isPalette and Quaqua.RootPane.isVertical

These properties can be used to realize floating palette windows.

These properties are only in effect, when the JRootPane decorates the JFrame/JDialog.

Setting the property Quaqua.RootPane.isPalette to true makes the title bar of the JFrame/JDialog always draw in the active state.

Setting the property Quaqua.RootPane.isVertical to true places the title bar of the JFrame/JDialog on the left instead of on the top.

Floating palettes work best, when the font size of the JRootPane is set to 11 or to 9. Font size 11 results in a small sized title bar. This is useful if you want to display a title in the title bar. Font size 9 is useful, if no title shall be displayed.

The following code snippet shows how to use the client properties and the font size:

JDialog d = new JDialog(myFrame);

d.setTitle("Palette Window");
d.setAlwaysOnTop(true);
d.setUndecorated(true);

d.setFocusableWindowState(false);

 

JRootPane rootPane = d.getRootPane();
rootPane.setWindowDecorationStyle(JRootPane.FRAME);
rootPane.setFont(new Font("Lucida Grande", Font.PLAIN, 11));
rootPane().putClientProperty("Quaqua.RootPane.isVertical", Boolean.TRUE);
rootPane().putClientProperty("Quaqua.RootPane.isPalette", Boolean.TRUE);

 

d.setVisible(true);

Note: To create a true floating palette, you are required to implement a handler which hides all floating palettes when no application window is active.